package net.llz.strategy;

public class VoucherActivity extends Strategy{
    /**
     * 传入优惠券
     */
    private double voucher;


    public  VoucherActivity(double voucher){
        this.voucher = voucher;
    }


    @Override
    public double computePrice(ProductOrder productOrder) {

        if(productOrder.getOldPrice() > voucher){
            return productOrder.getOldPrice() - voucher;
        }else {
            return 0;
        }

    }
}
